<template>
  <!--  采购计划详情-->
  <div class="applicationXQ">
    <el-dialog
      title="领用记录详情"
      :visible.sync="centerDialogVisible"
      width="75%"
      :close-on-click-modal="false"
      :modal-append-to-body="false"
      :before-close="close"
      class="dialog"
    >
      <div style="max-width:1000px;margin:auto;padding-bottom:50px;">
        <el-table :data="list.rows" border>
          <el-table-column type="index" label="序号" property="numericalOrder" width="55" align="center"/>
          <el-table-column label="材料类别" property="materialCategories" align="center" width="150" show-overflow-tooltip/>
          <el-table-column label="材料编号" property="materialNumber" align="center" width="100"/>
          <el-table-column label="物资名称" property="goodsName" align="center" width="120"/>
          <el-table-column label="物资规格" property="goodsSpecification" align="center" width="120"/>
          <el-table-column label="计量单位" property="goodsUnit"/>
          <el-table-column label="实发数量" property="releasedQuantity" width="150"/>
          <el-table-column label="计划单价" property="plannedUnitPrice" align="center" show-overflow-tooltip/>
          <el-table-column label="计划金额" property="planMoney"/>
          <el-table-column label="计划项目" property="planProject" align="center" show-overflow-tooltip/>
          <el-table-column label="用途" property="purpose" align="center" show-overflow-tooltip/>
        </el-table>
        <pagination
          :total="list.total?list.total:0"
          :page.sync="selectForm.pageNum"
          :limit.sync="selectForm.pageSize"
          @pagination="getList()"
        />
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {detailList} from "@/api/sparePartsBorrowRecord/index"
import {list} from "@/api/sparePartsBorrowRecord/index"
import {fileDownload} from '@/api/basicInformation/index'

export default {
  name: 'detail',
  props: ['pid'],
  data() {
    return {
      centerDialogVisible: true,
      detailForm: '',
      planList: '',
      subtotal: 0,//小计
      amount: 0,//数量

      list: {},
      selectForm: {
        sparePartsBorrowRecordId: 0,
        pageNum: 1,
        pageSize: 10,
      },
    }
  },
  created() {

    this.getList()
  },
  methods: {
    async getList() {
      this.selectForm.sparePartsBorrowRecordId = this.pid;
      let row = await detailList(this.selectForm);
      this.list = row;
      // for (let i = 0; i < this.detailForm.procureDevices.length; i++) {
      //   this.amount = Number(this.detailForm.procureDevices[i].anticipatedProcureNum) + Number(this.amount)
      //   this.subtotal = Number(this.detailForm.procureDevices[i].anticipatedProcurePrice) + Number(this.subtotal)
      // }
    },
    async fileDown(index, fileName, filePath) {
      this.downloadFile(encodeURI(filePath))
    },
    close() {
      this.$emit('subSetChane')
    },
  }
}
</script>
<style lang="scss" scoped>

.applicationXQ {
  margin-left: 20px;

  .dialog > > > .el-dialog__body {
    height: 85vh;
    overflow: scroll;
    // margin: 0 30px;
  }

  h4 {
    color: #05A380;
  }

  .blue {
    color: #2196F3;
  }

  .sum {
    margin-top: 20px;
    color: #666666;
    text-align: right;
    width: 1000px;

    .h4 {
      font-weight: bold;
    }

    .int {
      padding: 0 5px;
    }
  }

  .unloadBox {
    border: 1px solid #cccccc;
    margin-top: 20px;
    min-height: 50px;
    overflow: hidden;
    // width: 1000px;

    .file {
      width: 100%;
      border-top: 1px #cccccc dotted;
      line-height: 50px;

      .index {
        padding: 0 10px;
        color: #666
      }

      i {
        float: right;
        line-height: 50px;
        padding-right: 10px;
        font-size: 20px;
        cursor: pointer;
      }

      .type {
        color: #666;
        float: right;
        padding-right: 30px;
      }

    }
  }

  .table {
    border: 1px solid #cccccc;
    color: #606266;
    font-size: inherit;

    tr {

      td:nth-child(2n-1) {
        width: 180px;
        text-align: center;
      }

      td:nth-child(2n) {
        width: 320px;
        padding-left: 10px;
      }

      td {
        line-height: 35px;
      }
    }
  }

  .el-table {
    margin-top: 20px;
    width: 1000px;
  }
}

</style>
